package main

import "fmt"

type Person struct {
	name string
	age  int
	sex  string
}

//结构体嵌套结构体
type Student struct {
	//通过匿名字段实现继承操作
	Person //结构体名称作为结构体成员
	id    int
	score int
}

func main() {
	var s Student
	s.id = 1
	s.name = "zs"
	//s.Person.name="ls"
	s.age = 21
	s.sex = "男"
	s.score = 99

	fmt.Println(s)

	s1 := Student{Person{"ls", 28, "男"}, 2, 99}
	fmt.Println(s1)
}
